In general, a shift range switching device is used for switching a shift range of an automatic transmission utilizing an electric actuator constructed of an electric motor and a reduction gears. The shift range switching device switches actual shift range by controlling the rotative direction and rotation angle of the electric motor.
For example, as shown in FIGS. 20A, 20B, a shift range switching device includes a detent device for maintaining the shift range position.
A detent device 40 is constructed of a detent plate 46 and a detent spring 47. The detent plate 46 has multiple detent grooves 46a corresponding to shift ranges P, R, N, D, for example. The detent spring 47 is constructed of a blade spring. The detent spring 47 includes the hooking portion 47a in the tip end thereof. The hooking portion 47a engages with one of the detent grooves 46a. 
According to JP-A-2004-138406, an output angle detecting unit detects output angle of an output shaft of a reduction gears to detect an actual shift range. As referred to FIGS. 20A, 20B, the hooking portion 47a of the detent spring 47 is pressed toward the bottom of the detent groove 46a by bias force of the detent spring 47. Therefore, when the hooking portion 47a is distant from the lowest bottom point of the detent groove 46a, the hooking portion 47a applies force to the detent plate 46 such that the hooking portion 47a moves toward the lowest point of the bottom of the detent groove 46a. 
When supplying electricity to the electric motor is terminated after switching the shift range, the position of the detent plate needs to coincide with a position, in which the detent device stably stops, for stably positioning the detent plate. Accordingly, the motor control device needs to accurately control the rotation of the electric motor.
A transmission between the output shaft and the detent plate has mechanical backlash and play. Accordingly, the output angle of the output shaft may deviate from the rotation angle of the detent plate due to the backlash and play. The backlash and play are not uniform due to manufacturing tolerance of the components. In addition, the backlash and play may change due to ablation arising in components.
The output angle detecting unit may cause an error when detecting the output angle. Accordingly, it is further difficult to accurately detect the position of the detent plate, due to the detecting error and the backlash and play.
An output angle detecting unit disclosed in JP-A-2004-138406 outputs an analog signal corresponding to change in magnetism generated by rotation of the output shaft. The output angle detecting unit is constructed of a magnet and a linear output hall IC for detecting the output angle of the output shaft as a continuous quantity. However, accuracy of the angle detected using the output angle detecting unit 8 depends on various parameters such as accuracy of magnetism generated from the magnet 71, change in magnetism of the magnet 71 corresponding to change in temperature, reduction in magnetism of the magnet 71 due to heat cycle, and accuracy of assembling the magnet 71.
As influences of these parameters accumulate, the output angle detecting unit 8 loses accuracy. As a result, it is difficult to accurately detect the position of the detent plate.